<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <body>
        <div style="height: 30px;width: 120px;background: #65e;">好好学习</div>
        <button id = "btn1">隐藏</button>
        <button id = "btn2">显示</button>
    </body>
<script src="js/jquery-3.7.1.js"></script>
<script>
    $("#btn1").click(function(){
        //选择可见的div
        $("div:visible").hide();
    })
    $("#btn2").click(function(){
        //选择不可见的、
        $("div:hidden").show();
    })
</script>
</html>